package ro.bluecube.admlocal.persons.impl;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import ro.bluecube.admlocal.persons.PersonsServiceLocal;
import ro.bluecube.admlocal.persons.PersonsServiceRemote;
import ro.bluecube.admlocal.persons.entity.Person;

/**
 * @author anton
 * Stateless session bean
 */
@Stateless
public class PersonsServiceImpl implements PersonsServiceRemote, PersonsServiceLocal {
	
	@PersistenceContext
	EntityManager em;
	
	@SuppressWarnings("unchecked")
	public List<Person> getAllPersons() {
		return new ArrayList<Person>(em.createNamedQuery("findAllPersons").getResultList());
	}

}
